<template>
    <div id="login">
       
        <head>
            <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
            <title>美多商城-登录</title>
            <link rel="stylesheet" type="text/css" href="../../static/css/reset.css">
            <link rel="stylesheet" type="text/css" href="../../static/css/main.css">
        </head>
        <body>
            <div class="login_top clearfix">
                <a href="index.html" class="login_logo"><img src="../../static/images/logo02.png"></a>
            </div>

            <div class="login_form_bg" id='app'>
                <div class="login_form_wrap clearfix">
                    <div class="login_banner fl"></div>
                    <div class="slogan fl">商品美 · 种类多 · 欢迎光临</div>
                    <div class="login_form fr">
                        <div class="login_title clearfix">
                            <a href="javascript:;" class="cur">账户登录</a>
                        </div>
                        <div class="form_con">
                            <div class="form_input cur">
                                <form id="login-form" @submit.prevent="on_submit">
                                    <input type="text" v-model="username"  name="" class="name_input"
                                        placeholder="请输入用户名或手机号">
                                    <!-- <div v-show="error_username" class="user_error" v-cloak>请填写用户名或手机号</div> -->
                                    <input type="password" v-model="password"  name="pwd" class="pass_input"
                                        placeholder="请输入密码">
                                    <!-- <div v-show="error_pwd" class="pwd_error" v-cloak>{{ error_pwd_message }}</div> -->
                                    <div class="more_input clearfix">
                                        <input type="checkbox" v-model="remember">
                                        <label>记住登录</label>
                                        <a href="http://127.0.0.1:8080/#/send_eamil/">忘记密码</a>
                                    </div>
                                    <input type="button" name="" value="登 录" class="input_submit" @click="login_user()">
                                </form>
                            </div>
                        </div>
                        <div class="third_party">
                            <a :href="weibo_url" class="qq_login">微博</a>
                            <a href="#" class="weixin_login">微信</a>
                            <a href="/register.html" class="register_btn">立即注册</a>
                        </div>

                    </div>
                </div>
            </div>

            <div class="footer no-mp">
                <div class="foot_link">
                    <a href="#">关于我们</a>
                    <span>|</span>
                    <a href="#">联系我们</a>
                    <span>|</span>
                    <a href="#">招聘人才</a>
                    <span>|</span>
                    <a href="#">友情链接</a>
                </div>
                <p>CopyRight © 2016 北京美多商业股份有限公司 All Rights Reserved</p>
                <p>电话：010-****888 京ICP备*******8号</p>
            </div>
        </body>
    </div>
</template>
<script>
import axios from "axios"
// import {jwt_send_get,weibo_url_get} from "./axios_api/api"
export default {
    name:"login",
    data:function(){
        return{
            username:"",
            password:"",
            remember:"",
            weibo_url:"",
            
        }
    },methods:{
        login_user(){
              var data ={
                  "username":this.username,
                  "password":this.password,
              }
            //   jwt_send_get(data).then(res=>{
            //       console.log("在login里打印的-------->",res)
            //       sessionStorage.setItem("jwt_token",res.token)
            //   })
              axios({
                  url:"http://127.0.0.1:8000/login/",
                  method:"post",
                  data:data
              }).then(res=>{
                  console.log(res.data)
                  sessionStorage.setItem("jwt_token",res.data.token)
                  alert("登录成功")
              })
        },
        get_weibo_url(){
            // weibo_url_get().then(res=>{
            //     console.log("weibo_res-------->",res)
            // })
            axios({
                url:"http://127.0.0.1:8000/weibo_url/",
                method:"GET",
            }).then(res=>{
                console.log(res.data)
                console.log("res1111112", res)
                if(res.data.code==200){
                     this.weibo_url = res.data.url
                }else{
                    console.log("获取微博url失败了")
                }
            })
        }
    },created(){
        this.get_weibo_url()
    }
}
</script>
<style>

</style>